package cn.chenxi.hadoopproject.weather.controller;

import cn.chenxi.hadoopproject.base.response.JsonResult;
import cn.chenxi.hadoopproject.weather.pojo.dto.WeatherQuery;
import cn.chenxi.hadoopproject.weather.pojo.vo.WeatherVO;
import cn.chenxi.hadoopproject.weather.service.WeatherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@Api(tags = "天气分布查询")
@RequestMapping("/v1/weather")
public class WeatherController {
    @Autowired
    private WeatherService weatherService;

    @GetMapping("/select")
    @ApiOperation("查找天气分布")
    public JsonResult select(WeatherQuery weatherQuery) {
        List<WeatherVO> weatherVOS = weatherService.select(weatherQuery);
        return JsonResult.ok(weatherVOS);
    }
}
